home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
porttool.zoo
/
tr.man
< prev
next >
Wrap
Text File
|
1992-12-03
|
2KB
|
44 lines
NNAAMMEE
tr - translate characters
SSYYNNOOPPSSIISS
ttrr [ -cds ] [ _s_t_r_i_n_g_1 [ _s_t_r_i_n_g_2 ] ]
DDEESSCCRRIIPPTTIIOONN
ttrr copies the standard input to the standard output with
substitution or deletion of selected characters. The arguments
_s_t_r_i_n_g_1 and _s_t_r_i_n_g_2 are considered sets of characters. Any input
character found in _s_t_r_i_n_g_1 is converted into the character in the
corresponding position within _s_t_r_i_n_g_2. When _s_t_r_i_n_g_2 is short, it
is padded to the length of _s_t_r_i_n_g_1 by duplicating the last
character of _s_t_r_i_n_g_2.
In either string the notation:
_a-_b
denotes a range of characters from _a to _b in increasing ASCII
order. A backslash (\) followed by 1, 2 or 3 octal digits is
interpreted as the character whose ASCII code is given by those
digits. A backslash followed by any other character overrides any
special meaning for that character.
OOPPTTIIOONNSS
Any combination of the options may be used:
--cc Complement the set of characters in _s_t_r_i_n_g_1; match only those
characters nnoott appearing in _s_t_r_i_n_g_1.
--dd Delete all input characters in _s_t_r_i_n_g_1.
--ss Squeeze all strings of repeated output characters that are in
_s_t_r_i_n_g_2 to single characters.
EEXXAAMMPPLLEE
The following example creates a list of all the words in _f_i_l_e_1 one
per line in _f_i_l_e_2, where a word is taken to be a maximal string of
alphabetic characters.
tr -cs A-Za-z \012 <_f_i_l_e_1 >_f_i_l_e_2
CCooppyyrriigghhtt ((cc)) 11999911 FFrraannkk EE.. WWhhaalleeyy AAllll rriigghhttss rreesseerrvveedd